{% extends "base.html" %}
{% block title %}{{request.pageTitle}}{% endblock %}

{% block headerlink %}
<link href="/static/css/people_home.css" rel="stylesheet" type="text/css" media="all" />
<link href="/static/css/photo.css" rel="stylesheet" type="text/css" media="all" />
<link href="/static/css/explore.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript"> 
$(document).ready(function()
{
	{% include "people/follow_js.html" %}
	
	$("#delete-comment a").live("click", function(event)
	{
		if (confirm("确定删除这条评论吗?") == true)
		{
			photo_owner_id = $(this).attr('d-photo-owner-id');
			author_id = $(this).attr('d-author-id');
			comment_id = $(this).attr('d-comment-id');
			delete_comment(photo_owner_id,author_id,comment_id);
		}
    });
    
    function delete_comment(photo_owner_id,author_id,comment_id)
    {
        $.post("{{ request.HOME_PAGE_URL }}photos/delete_comment/",
        {
        	user_id:photo_owner_id,
        	author_id:author_id,
        	comment_id:comment_id
        },
        function(data)
        {
        	if(data.status=="success")
        	{
        		item = "#c_" + comment_id
        		$(item).remove();
        	}
        	else
        	{
        		alert(data.status);
        	}
        },
        "json"
    );}
});
</script>

{% endblock %}

{% block content %}
<div class="content-area" style="float:left;width:inherit;">

{% include "people/nav.html" %}

<div class="comment-list" style="clear:both;float:left;margin-top:30px;width:600px;">
{% for comment in comment_list %}
<div class="comment-item" id="c_{{comment.id}}">
	<div class="fleft">
	<a href="{{ request.HOME_PAGE_URL }}people/{{comment.author.id}}/">
	<img title="{{comment.author.name}}" src="{{comment.author.avatar_square_loc}}">
	</a>
	</div>

	<div class="comment-text-wrapper">
		<div class="comment-head">
		<span>{{comment.date_posted}}</span>
		<span class="blue-link" style="margin-left:10px;"><a title="{{comment.author.name}}" href="{{ request.HOME_PAGE_URL }}people/{{comment.author.id}}/">{{comment.author.name}}</a></span>
		{% if comment.deleted_by_photo_owner %}
		<span style="margin-left:10px;">照片拥有者删除了这条评论</span>
    	{% endif %} 	
    	{% if comment.photo_deleted %}
    	<span style="margin-left:10px;">这张照片已被删除</span>
    	{% endif %}
		<span class="fright delete-link" id="delete-comment">
        <a d-author-id="{{comment.author.id}}" d-comment-id="{{comment.id}}" d-photo-owner-id="{{comment.photo_owner.id}}" title="删除这条评论?" href="javascript:void(0);">&gt;删除</a>
    	</span>
		</div>
		<div class="comment-text" style="width:400px;">
		<span>{{comment.content}}</span>
		</div>
		<div class="fright" style="margin:10px;">
		{% if comment.photo_deleted %}
		<img title="这张照片已被删除" src="/static/img/default_album_cover.gif">
		{% else %}
		<a href="{{ request.HOME_PAGE_URL }}photos/{{comment.photo.owner.id}}/{{comment.photo.id}}/">
		<img title="{{comment.photo.title}}" src="{{comment.photo.square_loc}}">
		</a>		
		{% endif %}
		</div>
	</div>
</div>
{% endfor %}
</div>

<div class="green-link explore-nav-text fleft" style="margin-top:30px;margin-left:120px;">

{% if is_myComments %}
<span class="cfleft off" style="margin-bottom:15px;"><a href="{{ request.HOME_PAGE_URL }}people/{{request.user.id}}/comments/" title="评论我的">评论我的</a></span>
<span class="cfleft on" style=""><a href="{{ request.HOME_PAGE_URL }}people/{{request.user.id}}/comments/mine/" title="我的评论">我的评论</a></span>
{% else %}
<span class="cfleft on" style="margin-bottom:15px;"><a href="{{ request.HOME_PAGE_URL }}people/{{request.user.id}}/comments/" title="评论我的">评论我的</a></span>
<span class="cfleft off" style=""><a href="{{ request.HOME_PAGE_URL }}people/{{request.user.id}}/comments/mine/" title="我的评论">我的评论</a></span>
{% endif %}

</div>


</div>
{% endblock %}